package com.boyinet.imesh2json.netty.policy

interface RetryPolicy {
    /**
     * Called when an operation has failed for some reason. This method should return
     * true to make another attempt.
     *
     * @param retryCount the number of times retried so far (0 the first time)
     * @return true/false
     */
    fun allowRetry(retryCount: Int): Boolean

    /**
     * get sleep time in ms of current retry count.
     *
     * @param retryCount current retry count
     * @return the time to sleep
     */
    fun getSleepTimeMs(retryCount: Int): Long
}